package com.ym.student.common;

import lombok.Data;

public class result {
    @Data
    public class Result<T> {
        private int code;
        private String message;
        private T data;

        public <T> Result<T> success(T data) {
            Result<T> result = new Result<>();
            result.setCode(200);
            result.setMessage("成功");
            result.setData(data);
            return result;
        }

        public <T> Result<T> error(int code, String message) {
            Result<T> result = new Result<>();
            result.setCode(code);
            result.setMessage(message);
            return result;
        }
    }
}
